import unittest

# 创建--testloader--对象,参数：字符串类型
# TODO loaderTestFromName
# 模块名
# loader1 =unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1')

# 类名
# loader2 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1.Demo1TestCase')

# 方法名
# loader1 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1.Demo1TestCase.test1')
# loader2 = unittest.defaultTestLoader.loadTestsFromName('test_cases.test_demo1.Demo2TestCase.testb')

# TODO loaderTestFromNames
lists = ['test_cases.test_demo1.Demo1TestCase.test1','test_cases.test_demo2.Demo2TestCase.testb']
loader = unittest.defaultTestLoader.loadTestsFromNames(lists)

# suite
suite = unittest.TestSuite()
suite.addTest(loader)
# suite.addTest(loader2)

# runner
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
